﻿public class OpAstTree : LuaAstTree
{
    public string Operator;
    public LuaAstTree Left;
    public LuaAstTree Right;

    public OpAstTree(string @operator, LuaAstTree right, LuaAstTree left)
    {
        Operator = @operator;
        Left = left;
        Right = right;
    }
    public override void WriteTo(ICodeWriter writer)
    {
        writer.Code("(");
        Left.WriteTo(writer);
        writer.Code($" {Operator} ");
        Right.WriteTo(writer);
        writer.Code(")");
    }
}

public class IsAstTree : LuaAstTree
{
    public LuaAstTree Value { get; }
    public LuaTypeReference Type;
    public IsAstTree(LuaAstTree value, LuaTypeReference type)
    {
        Value = value;
        Type = type;
    }
    public override void WriteTo(ICodeWriter writer)
    {
        writer.Code($"__is__( ");
        Value.WriteTo(writer);
        writer.Code($", {ToLuaString(Type.FullName)}");
        writer.Code(" )");
        base.WriteTo(writer);
    }

}
